﻿@model WebApp.Models.DetailRestaurant

@{
    ViewBag.Title = "Detail Restaurant";
}

<h2>Detail Restaurant</h2>

<fieldset>
    <legend>Restaurant</legend>

    <div class="display-label">Nom</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.restaurant.Nom)
    </div>

    <div class="display-label">Adresse</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.restaurant.Adresse)
    </div>

    <div class="display-label">Capacite</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.restaurant.Capacite)
    </div>

    <div class="display-label">Telephone</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.restaurant.Telephone)
    </div>

    <div class="display-label">Email</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.restaurant.Email)
    </div>
</fieldset>

<p>
    @Html.ActionLink("Edit", "Edit", new { id=Model.restaurant.Id }) |
    @Html.ActionLink("Back to List", "Index")
</p>

<fieldset>
    <legend>Zones</legend>

    <p>
        @Html.ActionLink("Ajouter", "AjouterZone", new { id=Model.restaurant.Id })
    </p>
    <table>

    @if (Model.zones.Count != 0)
    { 
  
        <tr>
            <th>
                Numero
            </th>
            <th>
                Nombre de tables
            </th>
            <th>
                Serveur Actif
            </th>
            <th></th>
        </tr>

    foreach (var item in Model.zones)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Numero)
            </td>
            <td>
                @item.Table.Count()
            </td>
            <td>
                @{if(item.Serveur != null){@item.Serveur.Prenom @item.Serveur.Nom}else{<text>Pas de Serveur</text>}}
            </td>
            <td>
                @Html.ActionLink("Editer", "EditerZone", new { id = item.Id }) |
                @Html.ActionLink("Details", "DetailZone", new { id = item.Id }) |
                @Html.ActionLink("Suppression", "SupprimerZone", new { id = item.Id })
            </td>
        </tr>
    }
}
else
{
 <td colspan=4>
    Aucunes Zones
 </td>    
}
    </table>
</fieldset>